﻿using EAPWrapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace EAPWrapperWebTest.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
//            string reqestBody = @"<?xml version=""1.0""?>
//<Request>
//<Header Culture=""CN"" UserID=""Hotel.WSUser"" RequestType=""Hotel.Product.IsBookableService.RscWebServiceBookChecker"" AsyncRequest=""false"" />
//<RscWebServiceRequestEntity xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
//<HotelOrderContentEntity xsi:type=""RscHotelOrderContentRequestEntity"">
//<Arrival>2012-03-01T00:00:00</Arrival>
//<BalanceType>PP</BalanceType>
//<ClientComeFrom>1</ClientComeFrom>
//<ClientName>xiaoxiao</ClientName>
//<CorpUserID />
//<CustomerType>F</CustomerType>
//<Departure>2012-03-05T00:00:00</Departure>
//<EarlyArrivalTime>2012-03-01T12:00:00</EarlyArrivalTime>
//<FormatRemark />
//<HoldDeadLine>9999</HoldDeadLine>
//<IsChangeClientData>false</IsChangeClientData>
//<IsConfirmGuarantee>false</IsConfirmGuarantee>
//<IsInRange />
//<IsNeedUseFGToGetLastCancel>false</IsNeedUseFGToGetLastCancel>
//<IsNewProCanUse>true</IsNewProCanUse>
//<IsPreliminary>false</IsPreliminary>
//<Language>CN</Language>
//<LateArrivalTime>2012-03-01T14:00:00</LateArrivalTime>
//<MaxRoomCount>8</MaxRoomCount>
//<MaxValidRoom>0</MaxValidRoom>
//<MinState>1</MinState>
//<OrderID>0</OrderID>
//<Ori_OrderID>0</Ori_OrderID>
//<PaymentType />
//<Persons>1</Persons>
//<PrepayReserveType />
//<priceChangeFlag>F</priceChangeFlag>
//<PromoteEndDate>0001-01-01T00:00:00</PromoteEndDate>
//<PromoteStartDate>0001-01-01T00:00:00</PromoteStartDate>
//<PromoteType>0</PromoteType>
//<Quantity>1</Quantity>
//<RealRoomNumber>0</RealRoomNumber>
//<Room>187698</Room>
//<ServerFrom />
//<UID>123</UID>
//<UseFG />
//<Userlimited>9999</Userlimited>
//<ValidRoom>0</ValidRoom>
//</HotelOrderContentEntity>
//<ContactEntity xsi:type=""RscHotelOrderContactRequestEntity"">
//<ContractName>xiaoxiao</ContractName>
//<ContractTel>12345678</ContractTel>
//<ConfirmType>TEL</ConfirmType>
//<ContractEmail />
//<MobilePhone />
//<ForeignMobile />
//<ContractFax />
//</ContactEntity>
//<InvoiceEntity xsi:type=""RscHotelOrderInvoiceRequestEntity"">
//<AskForInvoice>0</AskForInvoice>
//<PostCode />
//<RevAddr />
//<RevPerName />
//</InvoiceEntity>
//<OperationType>NewHotelOrder</OperationType>
//<CreditCardEntity xsi:type=""RscCreditCardRequestEntity"">
//<CardInfoID>1000</CardInfoID>
//<CreditCardType>1</CreditCardType>
//</CreditCardEntity>
//</RscWebServiceRequestEntity>
//</Request>";
//            reqestBody = @"<?xml version=""1.0""?>
//<Request>
//  <Header Version=""1.0,2.0"" UserID=""Hotel.WSUser"" ReferenceID=""1514123013000013801"" RequestID=""edbbf879-b99a-4425-9739-253076b3486f"" RequestType=""Hotel.Booking.ReservationWS.HotelRatePlanRQ"" ClientIP=""172.16.169.218"" AsyncRequest=""false"" Timeout=""0"" MessagePriority=""3"" Environment=""dev"" AssemblyVersion=""2.8.0.1"" RequestBodySize=""0"" SerializeMode=""Xml"" RouteStep=""1""  />
//  <HotelRatePlanRQ Version=""1"" TimeStamp=""2014-12-30T13:36:40.6656958+08:00"" SearchCacheLevel=""Live"">
//    <POS ServerFrom=""taocan.ctrip.com"" Requestor=""VacationOnline"" />
//    <RatePlans>
//      <RatePlan BalanceType=""PP"" Quantity=""2"" GuestPerson=""3"">
//        <DateRange End=""2015-02-03"" Start=""2015-01-31"" />
//        <RoomCandidate RoomID=""2725188"">
//          <RatePlan CheckAvlID=""0"" RatePlanID=""0"" />
//        </RoomCandidate>
//      </RatePlan>
//    </RatePlans>
//  </HotelRatePlanRQ>
//</Request>";
//            var task = TAPWSAgent.RequestStringAsync(reqestBody);
//            string result;
//            //for (int i = 0; i < 10; i++)
//            //{
//            //    task = TAPWSAgent.RequestAsync(reqestBody);
//            //}
//             result = task.Result;
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
